package io.github.iogogogo.kafka.api;

import io.github.iogogogo.kafka.service.KafkaSender;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by tao.zeng on 2024/12/25.
 */
@Slf4j
@RequestMapping("/api/index")
public class IndexApi {

    @Resource
    private KafkaSender kafkaSender;

    @GetMapping("order")
    public String add(String orderInfo) {
        // TODO 订单业务处理
        // 下发消息到库存
        kafkaSender.send("tp_inventory_order_add", orderInfo);
        return "下单成功";
    }
}
